<?php
/**
 * Created by PhpStorm.
 * User: superxing-cto
 * Date: 17/5/9
 * Time: 11:37
 */

namespace App\Models;

/**
 * Class Coupon
 * @package App\Models
 * @property string title
 * @property integer order_scope 限制订单金额
 * @property integer price 
 * @property boolean status 状态
 * @property boolean is_repeat 
 */
class GeneralModule extends ApplicationModel
{
    protected $fillable = [
        'title',
        'icon',
        'status',
        'show_type',
		'sort',
        'tag_status',
        'start_time',
        'end_time'
    ];

    public function scopeRelease($query)
    {
        return $query->where('status',1)->where('start_time', '<=', date('Y-m-d H:i:s'))->where('end_time', '>=', date('Y-m-d H:i:s'));
        //return $query->where('start_time', '<=', date('Y-m-d H:i:s'))->where('end_time', '>=', date('Y-m-d H:i:s'));
    }

    public function show_type_str()
    {
        switch ($this->show_type) {
            case 1:
                return '模板1:左右轮播';
                break;
            case 2:
                return '模板2:5张图';
                break;
            default:
                return '未知';
        }
    }


}